﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ICE.Vacations.Logica.Users;
using System.Data;

namespace ICE.Vacations.WebASP
{
    public partial class solicitudImpropia : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                cargarUsuarios();
            }
            catch
            {
                Response.Redirect("Default.aspx", true);
            }
        }

        public  void cargarUsuarios()
        {


            if (!filtro.Text.Trim().Equals(""))
            {
                listaUsuarios.DataSource = UsersManager.getTodosUsuarios(listaCampos.SelectedValue, filtro.Text);
                
            }
            else{
            listaUsuarios.DataSource  = UsersManager.getTodosUsuarios();
           
            }
            
            listaUsuarios.DataBind();
        }

        protected void filtro_TextChanged(object sender, EventArgs e)
        {
        }

        protected void listaUsuarios_SelectedIndexChanged(object sender, EventArgs e)
        {
            
        }

        protected void listaUsuarios_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("irSolicitud"))
            {
                
                int index = Convert.ToInt32(e.CommandArgument);
                var r = UsersManager.getTodosRecursos()[index].cedula;
                Response.Redirect("solicitudPropia.aspx?ced="+r.ToString());
            }
        }

    }
}